﻿<%@ Control Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
    var getIDFeedback = function (grid) {
        var selectionModel = grid.getSelectionModel();
        if (selectionModel) {
            var selected = selectionModel.getSelected();
            if (selected)
                return selected.data.ID;
        }
        return ' ';
    };
</script>
<ext:RowLayout ID="RowLayout1" runat="server" Split="true">
    <Rows>
        <ext:LayoutRow RowHeight="0.4">
            <ext:FormPanel ID="TourFeedbackForm" runat="server" Border="false" Url="/TourProgram/SaveTourFeedback/"
                AutoScroll="true" LabelWidth="130">
                <Items>
                    <ext:Container ID="TourFeedbackFormContainer" runat="server" Flex="1">
                        <Items>
                            <ext:TextField ID="FeedbackGuestName" runat="server" FieldLabel="Guest Name" Width="300" />
                            <ext:TextField ID="FeedbackGuestFrom" runat="server" FieldLabel="Guest From" Width="300" />
                            <ext:TextField ID="FeedbackGuestEmail" runat="server" FieldLabel="Guest Email" Width="300" />
                            <ext:TextField ID="FeedbackGuestJob" runat="server" FieldLabel="Guest Job" Width="300" />
                            <ext:TextField ID="FeedbackTourProgress" runat="server" FieldLabel="Tour Progress"
                                Width="300" />
                            <ext:TextField ID="FeedbackOther" runat="server" FieldLabel="Other" Width="300" />
                        </Items>
                    </ext:Container>
                </Items>
                <BaseParams>
                    <ext:Parameter Name="IDTour" Value='<%# ViewData["IDTour"] %>' Mode="Value" AutoDataBind="true" />
                </BaseParams>
            </ext:FormPanel>
        </ext:LayoutRow>
        <ext:LayoutRow RowHeight="0.6">
            <ext:Panel ID="Panel3" runat="server" Title="Comment">
                <Items>
                    <ext:ColumnLayout ID="ColumnLayout1" runat="server" Split="true" FitHeight="true">
                        <Columns>
                            <ext:LayoutColumn ColumnWidth="0.70">
                                <ext:GridPanel Height="160" ID="GridPanelFeedback" runat="server" Header="false" StoreID="dsFeedback"
                                    Border="false" TrackMouseOver="true" AutoExpandColumn="Feature2" Layout="FitLayout">
                                    <ColumnModel ID="ColumnModel1xx" runat="server">
                                        <Columns>
                                            <ext:Column ColumnID="ServiceName" DataIndex="ServiceName" Header="Service Name" Width="200">
                                                <Editor>
                                                    <ext:TextField ID="txtServiceName" runat="server" AllowBlank="false" />
                                                </Editor>
                                            </ext:Column>
                                            <ext:Column ColumnID="TourGuideName" DataIndex="TourGuideName" Header="TourGuide"
                                                Width="100">
                                                <Editor>
                                                    <ext:ComboBox ID="cboTourGuideName" runat="server" StoreID="dsTourGuide" Editable="true"
                                                        DisplayField="Name" ValueField="Name" TypeAhead="true" Mode="Local" ForceSelection="true"
                                                        Width="300" TriggerAction="All" SelectOnFocus="true">
                                                    </ext:ComboBox>
                                                </Editor>
                                            </ext:Column>
                                            <ext:Column ColumnID="Feature1" DataIndex="Feature1" Header="" Width="150">
                                                <Editor>
                                                    <ext:TextField ID="txtFeature1" runat="server" AllowBlank="true" />
                                                </Editor>
                                            </ext:Column>
                                            <ext:Column ColumnID="Feature2" DataIndex="Feature2" Header="">
                                                <Editor>
                                                    <ext:TextField ID="txtFeature2" runat="server" AllowBlank="true" />
                                                </Editor>
                                            </ext:Column>
                                        </Columns>
                                    </ColumnModel>
                                    <SelectionModel>
                                        <ext:RowSelectionModel ID="RowSelectionModelxxx" runat="server">
                                            <Listeners>
                                                <RowSelect Handler="{#{dsFeedbackDetail}.reload();}" Buffer="250" />
                                            </Listeners>
                                        </ext:RowSelectionModel>
                                    </SelectionModel>
<%--                                    <BottomBar>
                                        <ext:PagingToolbar ID="PagingToolbar1xx" runat="server" PageSize="15" />
                                    </BottomBar>--%>
                                    <Listeners>
                                        <Command Fn="commandHandler" />
                                        <BeforeEdit Handler="return !(e.field=='ID' && !e.record.newRecord);" />
                                    </Listeners>
                                    <LoadMask ShowMask="true" />
                                    <SaveMask ShowMask="true" />
                                </ext:GridPanel>
                            </ext:LayoutColumn>
                            <ext:LayoutColumn ColumnWidth="0.30">
                                <ext:GridPanel Height="200" ID="GridPanelFeedbackDetail" runat="server" Header="false"
                                    Border="false" TrackMouseOver="true" Layout="FitLayout" AutoExpandColumn="Point">
                                    <Store>
                                        <ext:Store ID="dsFeedbackDetail" runat="server" RemoteSort="true" UseIdConfirmation="false">
                                            <Proxy>
                                                <ext:HttpProxy Url="/Tourism/TourProgram/GetListFeedbackDetail/" />
                                            </Proxy>
                                            <UpdateProxy>
                                                <ext:HttpWriteProxy Url="/Tourism/TourProgram/SaveFeedbackDetail/" />
                                            </UpdateProxy>
                                            <Reader>
                                                <ext:JsonReader IDProperty="ID" Root="data" TotalProperty="total">
                                                    <Fields>
                                                        <ext:RecordField Name="ID" />
                                                        <ext:RecordField Name="IDFeedback" />
                                                        <ext:RecordField Name="SortNo" />
                                                        <ext:RecordField Name="Name" />
                                                        <ext:RecordField Name="Point" />
                                                    </Fields>
                                                </ext:JsonReader>
                                            </Reader>
                                            <BaseParams>
                                                <ext:Parameter Name="IDFeedback" Value="getIDFeedback(#{GridPanelFeedback})" Mode="Raw"
                                                    AutoDataBind="true" />
                                            </BaseParams>
                                            <SortInfo Field="Name" Direction="ASC" />
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel ID="ColumnModel2xx" runat="server">
                                        <Columns>
                                            <ext:Column ColumnID="Name" DataIndex="Name" Header="Name" Width="150">
                                            </ext:Column>
                                            <ext:Column ColumnID="Point" DataIndex="Point" Header="Point" >
                                                <Editor>
                                                    <ext:NumberField ID="txtPoint" runat="server" EnableKeyEvents="true" 
                                                        DecimalPrecision="0" MaxLength="10" 
                                                        AllowBlank="true">
                                                    </ext:NumberField>
                                                </Editor>
                                            </ext:Column>
                                        </Columns>
                                    </ColumnModel>
<%--                                    <BottomBar>
                                        <ext:PagingToolbar ID="PagingToolbar2xx" runat="server" PageSize="15" />
                                    </BottomBar>--%>
                                    <Listeners>
                                        <Command Fn="commandHandler" />
                                        <BeforeEdit Handler="return !(e.field=='ID' && !e.record.newRecord);" />
                                    </Listeners>
                                    <LoadMask ShowMask="true" />
                                    <SaveMask ShowMask="true" />
                                </ext:GridPanel>
                            </ext:LayoutColumn>
                        </Columns>
                    </ext:ColumnLayout>
                </Items>
            </ext:Panel>
        </ext:LayoutRow>
    </Rows>
</ext:RowLayout>
